<?php

use yii\helpers\Url;
use yii\widgets\LinkPager;

$productList = $this->params['productList'];
?>
<section id="category-grid">
	<div class="container">

		<!-- ========================================= SIDEBAR ========================================= -->
		<div class="col-xs-12 col-sm-3 no-margin sidebar narrow">

			<!-- ========================================= PRODUCT FILTER ========================================= -->
			<!-- ========================================= PRODUCT FILTER : END ========================================= -->
			<div class="widget">
				<h1 class="border">热搜商品</h1>
				<ul class="product-list">
					<?php
					foreach ($productList['tui'] as $productUnit) {
						?>
						<li>
							<div class="row">
								<div class="col-xs-4 col-sm-4 no-margin">
									<a href="<?php echo Url::toRoute(['product/view', 'id' => $productUnit['productId']]); ?>" class="thumb-holder">
										<img alt="<?php echo Url::toRoute(['product/view', 'id' => $productUnit['productId']]); ?>" src="//<?php echo$productUnit['cover']; ?>" data-echo="//<?php echo$productUnit['cover']; ?>" />
									</a>
								</div>
								<div class="col-xs-8 col-sm-8 no-margin">
									<a href="<?php echo Url::toRoute(['product/view', 'id' => $productUnit['productId']]); ?>">&nbsp;&nbsp;<?php echo$productUnit['title']; ?> </a>
									<div class="price">
										<div class="price-prev">&nbsp;&nbsp;<?php echo$productUnit['price']; ?></div>
										<div class="price-current">&nbsp;<?php echo$productUnit['saleprice']; ?></div>
									</div>
								</div>  
							</div>
						</li>
					<?php } ?>
				</ul>
			</div><!-- /.widget -->
			<div class="widget">
			</div>
			<!-- ========================================= FEATURED PRODUCTS ========================================= -->
			<div class="widget">
				<h1 class="border">推荐商品</h1>
				<ul class="product-list">
					<?php
					foreach ($productList['hot'] as $productUnit) {
						?>
						<li>
							<div class="row">
								<div class="col-xs-4 col-sm-4 no-margin">
									<a href="<?php echo Url::toRoute(['product/view', 'id' => $productUnit['productId']]); ?>" class="thumb-holder">
										<img alt="<?php echo Url::toRoute(['product/view', 'id' => $productUnit['productId']]); ?>" src="//<?php echo$productUnit['cover']; ?>" data-echo="//<?php echo$productUnit['cover']; ?>" />
									</a>
								</div>
								<div class="col-xs-8 col-sm-8 no-margin">
									<a href="<?php echo Url::toRoute(['product/view', 'id' => $productUnit['productId']]); ?>">&nbsp;&nbsp;<?php echo$productUnit['title']; ?> </a>
									<div class="price">
										<div class="price-prev">&nbsp;&nbsp;<?php echo$productUnit['price']; ?></div>
										<div class="price-current">&nbsp;<?php echo$productUnit['saleprice']; ?></div>
									</div>
								</div>  
							</div>
						</li>
					<?php } ?>
				</ul><!-- /.product-list -->
			</div><!-- /.widget -->
			<!-- ========================================= FEATURED PRODUCTS : END ========================================= -->
		</div>
		<!-- ========================================= SIDEBAR : END ========================================= -->

		<!-- ========================================= CONTENT ========================================= -->

		<div class="col-xs-12 col-sm-9 no-margin wide sidebar">
			<section id="gaming">
				<div class="grid-list-products">
					<div class="tab-content">
						<div id="grid-view" class="products-grid fade tab-pane in active">
							<div class="product-grid-holder">
								<?php
								$i = 0;
								foreach ($searchList as $product) {
									if ($i % 3 == 0) {
										?>
										<div class = "row no-margin">
											<?php
										}
										?>

										<div class="col-xs-12 col-sm-4 no-margin product-item-holder hover">
											<div class="product-item">
												<?php if (rand(0, 10) > 5) {
													?>
													<div class="ribbon red"><span>热卖</span></div> 
												<?php } ?>
												<div class="image">
													<a href="<?php echo Url::toRoute(['product/view', 'id' => $product['productId']]); ?>">
														<img width="300px" height="300px" alt="" src="//<?php echo$product['cover']; ?>"/>
													</a>
												</div>
												<div class="body">
													<div class="title">
														<a href="<?php
														echo Url::toRoute(['product/view',
															'id' => $product['productId']]);
														?>"><?php echo$product['title']; ?></a>
													</div>
													<!--													<div class="brand">sony</div>-->
												</div>
												<div class="prices">
													<div class="price-prev"><?php echo$product['price']; ?></div>
													<div class="price-current pull-right"><?php echo$product['saleprice']; ?></div>
												</div>
												<div class="hover-area">
													<div class="add-cart-button">
														<a href="<?php echo Url::toRoute(['product/view', 'id' => $product['productId']]); ?>" 
														   class="le-button">添加到购物车</a>
													</div>
													<div class="wish-compare">
														<a class="btn-add-to-wishlist" href="#">添加到心愿单</a>
														<a class="btn-add-to-compare" href="#">关注</a>
													</div>
												</div>
											</div><!-- /.product-item -->
										</div><!-- /.product-item-holder -->
										<?php
										$i++;
										if ($i % 3 == 0) {
											?>
										</div>
										<?php
									}
								}
								?>
							</div><!-- /.product-grid-holder -->

							<div class="pagination-holder">
								<div class="row">

									<div class="col-xs-12 col-sm-6 text-left">
										<?php
										echo LinkPager::widget([
											'pagination' => $pagination,
										]);
										?>
									</div>

									<div class="col-xs-12 col-sm-6">
										<div class="result-counter">
<?php echo "共" . $count . "个搜索结果"; ?>
										</div>
									</div>

								</div><!-- /.row -->
							</div><!-- /.pagination-holder -->
						</div><!-- /.products-grid #grid-view -->



					</div><!-- /.tab-content -->
				</div><!-- /.grid-list-products -->

			</section><!-- /#gaming -->            
		</div><!-- /.col -->
		<!-- ========================================= CONTENT : END ========================================= -->    
	</div><!-- /.container -->
</section><!-- /#category-grid -->		